flags="-DWRITE_QUORUM_SIZE=2" "-DOUTSTANDING_LIMIT=100"
INCLUDE = -I. -I./include -I./generated -I./tests
test : zookeeper.o test.o recordio.o mt_adaptor.o zk_log.o hashtable.o hashtable_itr.o zookeeper.jute.o block_storage.o pending_queue.o
	gcc -g -lpthread -lm -o test zookeeper.o test.o recordio.o mt_adaptor.o zk_log.o hashtable.o hashtable_itr.o zookeeper.jute.o block_storage.o pending_queue.o

zookeeper.jute.o : generated/zookeeper.jute.c
	gcc ${flags} -g -I./include -c generated/zookeeper.jute.c

zookeeper.o : src/zookeeper.c
	gcc ${flags} -g ${INCLUDE} -c src/zookeeper.c

test.o : src/test.c
	gcc ${flags} -g ${INCLUDE} -c src/test.c

load_gen.o : src/load_gen.c
	gcc ${flags} -g ${INCLUDE} -c src/load_gen.c

recordio.o : src/recordio.c
	gcc ${flags} -g ${INCLUDE} -c src/recordio.c

mt_adaptor.o : src/mt_adaptor.c
	gcc ${flags} -g ${INCLUDE} -c src/mt_adaptor.c


zk_log.o : src/zk_log.c
	gcc ${flags} -g ${INCLUDE} -c src/zk_log.c

hashtable.o : src/hashtable/hashtable.c
	gcc ${flags} -g ${INCLUDE} -c src/hashtable/hashtable.c

hashtable_itr.o : src/hashtable/hashtable_itr.c
	gcc ${flags} -g ${INCLUDE} -c src/hashtable/hashtable_itr.c

block_storage.o : src/block_storage.c
	gcc ${flags} -g ${INCLUDE} -c src/block_storage.c

pending_queue.o : src/pending_queue.c
	gcc ${flags} -g ${INCLUDE} -c src/pending_queue.c


clean:
	rm *.o test
